from django.conf.urls import url
from . import views
from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [
    #/users/usernames/(?P<username>\w{5,20})/count/
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.RegisterUsernameView.as_view(),name='usernamecount'),
    url(r'^$',views.RegisterCreateUserView.as_view()),

    # url(r'^auths/', obtain_jwt_token),
    url(r'^auths/',views.UserAuthorizationView.as_view()),

    url(r'^infos/$',views.UserCenterInfoView.as_view()),

    url(r'^emails/$',views.UserUpdateEmailView.as_view()),

    url(r'^emails/verification/$',views.UserEmailActiveView.as_view()),

    # url(r'^addresses/$',views.AddressView.as_view()),

    url(r'^browerhistories/$',views.UserHistoryView.as_view()),

]


from .views import AddressViewSet
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register(r'addresses',AddressViewSet,base_name='address')
urlpatterns += router.urls



"""
header:     eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
payload:    eyJlbWFpbCI6IiIsInVzZXJfaWQiOjMsInVzZXJuYW1lIjoiYmJiYmIiLCJleHAiOjE1NDE2NDQwMDd9.
signature:  DB58AadcASId7n7TOHlrtQLriEK2TP8Ph0932YnKTAM

"""

"""
1.当我们输入用户名和密码的时候,我们是把它们传递给了jwt_token
    rest_framework_jwt 是建立在rest_framework基础之上的
    rest_framework_jwt的认证 也是建立在rest_framework基础之上的

2.系统只是使用用户名来进行判断
    我们的需求是除了用户名之外还可以使用手机号来进行登录
    User.objects.get(mobile=mobile)
    User.objects.get(username=username)

"""
from django.contrib.auth.backends import ModelBackend
